// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import "./assets/css/golbal.css"
import axios from "axios"
//树形表格插件
import ZkTable from 'vue-table-with-tree-grid'
/*import da from "element-ui/src/locale/lang/da";*/
//富文本插件
import VueQuillEditor from 'vue-quill-editor'
import NProgress from "nprogress"

import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme
import "nprogress/nprogress.css"

Vue.config.productionTip = false

Vue.use(ElementUI)
Vue.use(ZkTable)
Vue.use(VueQuillEditor)

//全局过滤器
Vue.filter("dataFormat",(originVal)=>{
  const data=new Date(originVal);

  const y=data.getFullYear()
  const m=(data.getMonth()+1+"").padStart(2,"0");
  const d=(data.getDate()+1+"").padStart(2,"0");

  const hh=(data.getHours()+1+"").padStart(2,"0");
  const mm=(data.getMinutes()+1+"").padStart(2,"0");
  const ss=(data.getSeconds()+1+"").padStart(2,"0");

  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})

//配置请求根路径
axios.defaults.baseURL="http://localhost:8888/api/private/v1/"
//在request拦截器中展示进度条NProgress.start();
axios.interceptors.request.use(config=>{
  NProgress.start();
  config.headers.Authorization=window.sessionStorage.getItem("token");
  //在最后必须 return config
  return config;
})
//在response拦截器中隐藏进度条NProgress.done();
axios.interceptors.response.use(config=>{
  NProgress.done();
  //在最后必须 return config
  return config;
})
Vue.prototype.$http=axios;

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  render:h=>h(App)
})
